import { getDepartmentList } from '@/api/departments'
import { todo } from '@/utils/index'
export default {
  namespaced: true,
  state: {
    list: [],
    depart: {}
  },
  mutations: {
    getDpt(state, list) {
      state.list = todo(list.depts, '')
      state.depart = {
        id: '',
        companyId: list.companyId,
        manager: list.companyManager || '负责人',
        name: list.companyName || '江苏传智播客教育科技股份有限公司'
      }
    }
  },
  actions: {
    async getDptList(context) {
      const res = await getDepartmentList()
      context.commit('getDpt', res.data)
    }
  }
}
